package net.huashitong.Indicators.web;

import com.sirdc.modules.core.web.JsonBaseController;
import com.sirdc.modules.core.web.model.Message;
import net.huashitong.Indicators.entity.IndicatorBreakdown;
import net.huashitong.Indicators.filter.IndicatorBreakdownFilter;
import net.huashitong.Indicators.service.IndicatorBreakdownService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/changle/indicator")
public class ChangLeIndicatorController extends JsonBaseController {
    @Override
    protected String getView(String s) {
        return null;
    }

    @Autowired
    private IndicatorBreakdownService indicatorBreakdownService;

    /**
     * 长乐银行项目调用接口
     * 根据年份获取所有经济数据
     * @param filter
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/queryAllDataByYear", method = RequestMethod.POST)
    public Message queryAll(@RequestBody IndicatorBreakdownFilter filter) {
        String year = filter.getYear();
        String area = filter.getArea();
        List<Map<String, Object>> result = indicatorBreakdownService.queryAllDataByYear(year, area);
        return coverMessage("200", "获取成功", result);
    }
}
